<?php
use common\service\StaticService;
use common\service\GlobalUrlService;
use backend\assets\AdminAsset;

StaticService::includeAppJsStatic(GlobalUrlService::buildStaticUrl('/backend/active/info.js'),AdminAsset::class);
?>

<div class="layui-card">
    <div class="layui-card-header">活动详情</div>
    <div class="layui-card-body">
        <div class="layui-form-item">
            <label class="layui-form-label">活动名称</label>
            <div class="layui-inline">
                <input type="text" class="layui-input" value="<?= $active['active_name'] ?>" disabled>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">活动时间</label>
            <div class="layui-inline">
                <input type="text" class="layui-input" value="<?=date('Y-m-d', $active['begin_time']) ?>" disabled>
            </div>-
            <div class="layui-inline">
                <input type="text" class="layui-input" value="<?=date('Y-m-d', $active['end_time']) ?>" disabled>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">活动人数</label>
            <div class="layui-inline">
                <input type="text" class="layui-input" value="<?= $active['active_num'] ?>" disabled>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">人成团</label>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">规格</label>
            <div class="layui-inline">
                <table class="layui-table">
                    <colgroup>
                        <?php foreach ($active_attr['thead'] as $th):?>
                            <col width="120"></col>
                        <?php endforeach;?>
                        <col>
                        <col width="120">
                        <col width="120">
                        <col width="120">
                        <col width="120">
                    </colgroup>
                    <thead>
                        <tr>
                            <?php foreach ($active_attr['thead'] as $th):?>
                                <th><?= $th?></th>
                            <?php endforeach;?>
                            <th>图片</th>
                            <th>原价</th>
                            <th>拼团价</th>
                            <th>拼团库存</th>
                            <th>销量</th>
                        </tr>
                    </thead>
                    <tbody class="tbody">
                        <?php foreach ($active_attr['tbody'] as $key=>$v):?>
                            <tr>
                                <?php foreach ($v['val'] as $nv):?>
                                <td><?= $nv['value'] ?></td>
                                <?php endforeach;?>
                                <td><img class="showPicc" src="<?php echo GlobalUrlService::buildCdnUrl($v['attr_img'])?>"></td>
                                <td><?= $v['original_price'] ?></td>
                                <td><?= $v['collage_price'] ?></td>
                                <td><?= $v['inventory']?></td>
                                <td><?= $v['sales_volume']?></td>
                            </tr>
                        <?php endforeach;?>
                    </tbody>
                </table>
            </div>
        </div>

        <div class="layui-form-item">
            <a class="layui-btn layui-btn-primary" onclick="window.history.go(-1);">返回</a>
        </div>
    </div>
</div>